//
//  MPUserAccount.swift
//  MPSinaWeibo
//
//  Created by DaVinci on 16/4/10.
//  Copyright © 2016年 DaVinci. All rights reserved.
//

import UIKit

class MPUserAccount: NSObject {
  
    //用户授权的唯一票据
    var access_token: String?
    //access_token的生命周期，单位是秒数。
    var expires_in: NSTimeInterval = 0 {
    
        didSet{
         
            expires_date = NSDate(timeIntervalSinceNow: expires_in)
        
        }
    
    }
    
    //添加过期日期字段
    var expires_date: NSDate?
    //标识唯一用户的id
    var uid: String?
    //用户显示名称
    var name: String?
    //用户头像 180 * 180
    var avatar_large: String?
    
 
    
    init(dict: [String : AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {    }
    
    //MARK: 将对象转化为字符串
    override var description: String {
        let keys = ["access_token","avatar_large","name","uid","expires_in"]
        let dict = self.dictionaryWithValuesForKeys(keys)
        return dict.description
    }
    
    

}
